import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';

// 语言资源
const resources = {
  zh: {
    translation: {
      // 导航菜单
      navigation: {
        home: "首页",
        courses: "课程",
        about: "关于我们",
        contact: "联系我们",
        profile: "个人中心",
        logout: "退出登录",
        dashboard: "控制台",
        management: "管理中心"
      },
      
      // 登录页面
      login: {
        title: "用户登录/注册",
        close: "关闭",
        passwordLogin: "密码登录",
        codeLogin: "验证码登录",
        phoneEmailPlaceholder: "请输入手机/邮箱/用户名",
        phonePlaceholder: "请输入手机号",
        passwordPlaceholder: "请输入密码",
        codePlaceholder: "请输入验证码",
        loginButton: "登 录",
        loginButtonLoading: "登录中...",
        forgotPassword: "忘记密码？",
        register: "立即注册",
        getCode: "获取验证码",
        getCodeRetry: "秒后重发",
        thirdPartyLogin: "更多账号登录方式：",
        wechatLogin: "微信登录",
        qqLogin: "QQ登录",
        agreement: "登录即代表您已同意服务条款",
        serviceTerms: "《服务条款和隐私政策》",
        errors: {
          fillRequired: "请输入手机/邮箱和密码",
          fillPhoneCode: "请输入手机号和验证码",
          invalidPhone: "请输入有效的手机号",
          invalidEmail: "请输入有效的邮箱",
          enterPhoneOrEmail: "请先输入手机号或邮箱",
          enterValidPhoneOrEmail: "请输入有效的手机号或邮箱",
          sendCodeFailed: "发送验证码失败，请稍后重试",
          wrongCredentials: "用户名或密码错误",
          networkError: "无法连接到服务器，请检查网络",
          serverError: "服务器错误"
        }
      },
      
      // 注册页面
      register: {
        title: "用户注册",
        phoneRegister: "手机注册",
        emailRegister: "邮箱注册",
        usernamePlaceholder: "请输入用户名",
        phonePlaceholder: "请输入手机号",
        emailPlaceholder: "请输入邮箱地址",
        passwordPlaceholder: "请输入密码",
        confirmPasswordPlaceholder: "请确认密码",
        codePlaceholder: "请输入验证码",
        identity: "身份",
        student: "学生",
        teacher: "教师",
        parent: "家长",
        registerButton: "注 册",
        registeringButton: "注册中...",
        hasAccount: "已有账号？",
        loginNow: "立即登录",
        passwordStrength: "密码强度",
        weak: "弱",
        medium: "中",
        strong: "强",
        passwordRequirements: {
          length: "8-16位字符",
          uppercase: "包含大写字母",
          lowercase: "包含小写字母",
          number: "包含数字",
          symbol: "包含特殊字符",
          noSpace: "不含空格",
          noRepeat: "无连续重复字符",
          noConsecutive: "无连续字符序列",
          noUsername: "不包含用户名"
        }
      },
      
      // 新增的注册页面翻译键
      user_registration: "用户注册",
      phone_registration: "手机注册",
      email_registration: "邮箱注册",
      username: "用户名",
      please_enter_username: "请输入用户名",
      identity_information: "身份信息",
      student: "学生",
      teacher: "教师",
      phone_number: "手机号码",
      please_enter_phone_number: "请输入手机号码",
      email: "邮箱",
      please_enter_email: "请输入邮箱",
      verification_code: "验证码",
      please_enter_verification_code: "请输入验证码",
      password: "密码",
      please_set_8_16_password: "请设置8-16位密码",
      password_strength: "密码强度",
      password_length_8_16: "密码长度为8-16位",
      password_at_least_three_types: "包含大写字母、小写字母、数字、特殊符号中至少三种",
      password_no_space: "不能包含空格",
      password_no_repeat_three_chars: "不能有连续或重复的三个及以上字符",
      password_no_username: "密码不能包含用户名",
      confirm_password: "确认密码",
      please_enter_password_again: "请再次输入密码",
      register: "注册",
      other_registration_methods: "其他注册方式",
      wechat_scan_to_register: "微信扫码注册",
      qq_scan_to_register: "QQ扫码注册",
      register_means_you_agree: "注册即代表您已同意",
      terms_of_service: "《服务条款》",
      and: "和",
      privacy_policy: "《隐私政策》",
      already_have_an_account: "已有账号",
      log_in_now: "立即登录",
      get_verification_code: "获取验证码",
      seconds_later_resend: "秒后重发",
      password_strength_weak: "弱",
      password_strength_medium: "中",
      password_strength_strong: "强",
      phone_required: "请输入手机号",
      phone_invalid: "请输入有效的手机号",
      email_required: "请输入邮箱",
      email_invalid: "请输入有效的邮箱",
      verification_code_sent: "验证码已发送到",
      send_verification_code_failed: "发送验证码失败",
      third_party_login_prompt: "登录窗口已打开，请在新窗口中扫码完成授权登录",
      get_login_url_failed: "获取登录链接失败",
      third_party_login_failed: "登录失败",
      please_try_again: "请稍后再试",
      username_required: "请输入用户名",
      verification_code_required: "请输入验证码",
      verification_code_length: "验证码应为6位",
      password_required: "请输入密码",
      password_no_consecutive_chars_or_numbers: "密码不能包含连续的三个及以上字符或数字",
      confirm_password_required: "请确认密码",
      passwords_do_not_match: "两次密码输入不一致",
      registration_successful: "注册成功",
      redirecting_to_login: "即将跳转到登录页面",
      registration_failed: "注册失败",
      
      // 主页
      home: {
        welcome: "欢迎使用",
        brandName: "智绘师",
        mainTitle: "欢迎来到智绘师教育",
        mainSubtitle: "为孩子的未来提供优质的教育资源",
        banners: {
          promotion1: "智绘师20年感恩季 老学员购学而思学习机最高立减600元 了解详情",
          promotion2: "新学员专享优惠 首次购买学习机立减300元 立即抢购",
          promotion3: "寒假课程火热报名中 早鸟价限时优惠 查看详情"
        },
        // 导航菜单
        navigation: {
          home: "首页",
          learningMachine: "学习机", 
          onlineSchool: "智绘师网校",
          premiumCourses: "培优素养课",
          smartBooks: "智能图书",
          aiModel: "九章大模型",
          ourStory: "我们的故事",
          allMenu: "全部"
        },
        // 抽屉菜单
        drawer: {
          title: "智绘师",
          selectCourse: "选课",
          learningClub: "学习俱乐部", 
          schedule: "课程表",
          mobileApp: "智绘师移动应用",
          smartBooks: "智能图书",
          premiumSelection: "精品课臻选",
          premiumLecture: "精品课讲堂",
          shanghaiClass: "上海智绘课堂",
          aboutUs: "关于智绘师",
          helpCenter: "帮助中心",
          logout: "退出登录"
        },
        // 产品信息
        products: {
          title: "精选产品",
          viewAll: "查看全部",
          addToCart: "加入购物车",
          buyNow: "立即购买",
          mobi: "摩比爱数学",
          secret: "学而思秘籍",
          machine: "摩比启蒙机",
          basic: "学而思基本功",
          training: "课内培优",
          descriptions: {
            mobi: "畅销超400万册的思维启蒙网红图书",
            secret: "思维培养、基础巩固",
            machine: "启蒙新方式一机全搞定",
            basic: "扩展延伸、阶段复习",
            training: "思维培养、基础巩固"
          }
        },
        // 课程相关
        courses: {
          title: "精品课程",
          premium: "精品课程",
          premiumSelection: "精品课臻选",
          free: "免费课程",
          popular: "热门推荐",
          latest: "最新上线",
          viewAll: "查看全部",
          enrollNow: "立即报名",
          tags: {
            hot: "热销",
            new: "新课", 
            discount: "限时优惠"
          },
          items: {
            mathThinking: "小学数学思维训练",
            englishStart: "英语启蒙精品课",
            programmingThinking: "编程思维启蒙"
          },
          descriptions: {
            mathThinking: "培养逻辑思维，提升数学能力",
            englishStart: "趣味英语学习，打好语言基础", 
            programmingThinking: "培养计算思维，掌握未来技能"
          }
        },
        // 底部标签栏
        tabBar: {
          home: "首页",
          courses: "课程", 
          books: "图书",
          chat: "聊天",
          profile: "我的"
        },
        footer: {
          about: "关于我们",
          contact: "联系我们",
          help: "帮助中心",
          terms: "服务条款",
          privacy: "隐私政策"
        }
      },
      
      // 后台管理
      admin: {
        title: "管理后台",
        welcome: "欢迎来到管理中心",
        menu: {
          dashboard: "首页",
          userManagement: "用户管理",
          students: "学员管理",
          teachers: "讲师管理",
          courseManagement: "课程管理",
          orderManagement: "订单管理",
          orders: "订单",
          refunds: "退款",
          contentManagement: "资讯管理",
          banners: "轮播图管理",
          articles: "文章管理",
          promotionManagement: "促销管理",
          flashSales: "秒杀活动",
          coupons: "优惠券管理",
          systemSettings: "系统设置"
        },
        content: {
          refunds: "退款管理内容",
          banners: "轮播图管理内容",
          articles: "文章管理内容",
          flashSales: "秒杀活动管理内容",
          coupons: "优惠券管理内容",
          systemSettings: "系统设置内容"
        },
        breadcrumb: {
          home: "首页",
          userManagement: "用户管理",
          students: "学员",
          teachers: "讲师",
          courseManagement: "课程管理",
          orderManagement: "订单管理",
          orders: "订单",
          refunds: "退款",
          contentManagement: "资讯管理",
          banners: "轮播图",
          articles: "文章",
          promotionManagement: "促销管理",
          flashSales: "秒杀活动",
          coupons: "优惠券",
          systemSettings: "系统设置"
        },
        actions: {
          add: "添加",
          edit: "编辑",
          delete: "删除",
          view: "查看",
          export: "导出",
          import: "导入",
          refresh: "刷新",
          search: "搜索",
          filter: "筛选",
          reset: "重置"
        },
        table: {
          noData: "暂无数据",
          total: "共 {count} 条",
          pageSize: "每页显示",
          items: "条"
        }
      },
      
      // 课程相关
      course: {
        title: "课程中心",
        categories: "课程分类",
        allCourses: "全部课程",
        myLearning: "我的学习",
        completed: "已完成",
        inProgress: "学习中",
        notStarted: "未开始",
        duration: "课程时长",
        difficulty: "难度等级",
        beginner: "初级",
        intermediate: "中级",
        advanced: "高级",
        instructor: "讲师",
        students: "学员数",
        rating: "评分",
        price: "价格",
        free: "免费",
        enroll: "立即报名",
        preview: "课程预览",
        details: "课程详情",
        reviews: "课程评价",
        curriculum: "课程大纲"
      },
      
      // 直播相关
      live: {
        title: "直播中心",
        liveNow: "正在直播",
        upcoming: "即将开始",
        replay: "回放",
        joinLive: "进入直播间",
        startLive: "开始直播",
        endLive: "结束直播",
        viewers: "观看人数",
        likes: "点赞数",
        comments: "评论",
        share: "分享",
        fullscreen: "全屏",
        settings: "设置",
        quality: "画质",
        volume: "音量"
      },
      
      // AI聊天
      ai: {
        title: "AI助手",
        placeholder: "请输入您的问题...",
        send: "发送",
        thinking: "思考中...",
        newChat: "新对话",
        history: "历史记录",
        clear: "清空对话",
        export: "导出对话",
        suggestions: "建议问题",
        interrupted: "已中断AI回复"
      },
      
      // 安全验证
      security: {
        title: "安全验证",
        back: "返回",
        riskUser: "风险用户账户",
        abnormalLogin: "异地登录检测",
        selectMethod: "选择验证方式：",
        enterPassword: "请输入当前账户密码",
        enterCode: "请输入验证码",
        sending: "发送中...",
        sendCode: "发送验证码",
        verifying: "验证中...",
        verify: "确认验证",
        cancel: "取消",
        enterVerification: "请输入验证信息",
        verificationFailed: "验证失败，请稍后重试"
      },
      
      // 语言选择器
      language: {
        select: "选择语言",
        chinese: "中文",
        english: "English",
        japanese: "日本語",
        korean: "한국어"
      },
      
      // 通用
      common: {
        loading: "加载中...",
        success: "登录成功",
        failed: "登录失败",
        confirm: "确认",
        cancel: "取消",
        save: "保存",
        edit: "编辑",
        delete: "删除",
        search: "搜索",
        reset: "重置",
        rememberMe: "记住我",
        submit: "提交",
        close: "关闭",
        back: "返回",
        next: "下一步",
        previous: "上一步",
        finish: "完成",
        retry: "重试",
        refresh: "刷新",
        copy: "复制",
        download: "下载",
        upload: "上传",
        preview: "预览",
        print: "打印",
        settings: "设置",
        help: "帮助",
        about: "关于",
        version: "版本",
        update: "更新",
        new: "新建",
        open: "打开",
        selectAll: "全选",
        clear: "清空",
        expand: "展开",
        collapse: "收起",
        more: "更多",
        less: "收起"
      }
    }
  },
  en: {
    translation: {
      navigation: {
        home: "Home",
        courses: "Courses",
        about: "About Us",
        contact: "Contact",
        profile: "Profile",
        logout: "Logout",
        dashboard: "Dashboard",
        management: "Management"
      },
      
      login: {
        title: "User Login/Register",
        close: "Close",
        passwordLogin: "Password Login",
        codeLogin: "Verification Code Login",
        phoneEmailPlaceholder: "Please enter phone/email/username",
        phonePlaceholder: "Please enter phone number",
        passwordPlaceholder: "Please enter password",
        codePlaceholder: "Please enter verification code",
        loginButton: "Login",
        loginButtonLoading: "Logging in...",
        forgotPassword: "Forgot password?",
        register: "Register now",
        getCode: "Get code",
        getCodeRetry: "Retry after",
        thirdPartyLogin: "More login methods:",
        wechatLogin: "WeChat Login",
        qqLogin: "QQ Login",
        agreement: "Login means you agree to the terms of service",
        serviceTerms: "Terms of Service and Privacy Policy",
        errors: {
          fillRequired: "Please enter phone/email and password",
          fillPhoneCode: "Please enter phone number and verification code",
          invalidPhone: "Please enter a valid phone number",
          invalidEmail: "Please enter a valid email",
          enterPhoneOrEmail: "Please enter phone number or email first",
          enterValidPhoneOrEmail: "Please enter a valid phone number or email",
          sendCodeFailed: "Failed to send verification code, please try again later",
          wrongCredentials: "Wrong username or password",
          networkError: "Unable to connect to server, please check network",
          serverError: "Server error"
        }
      },
      
      register: {
        title: "User Registration",
        phoneRegister: "Phone Registration",
        emailRegister: "Email Registration",
        usernamePlaceholder: "Please enter username",
        phonePlaceholder: "Please enter phone number",
        emailPlaceholder: "Please enter email address",
        passwordPlaceholder: "Please enter password",
        confirmPasswordPlaceholder: "Please confirm password",
        codePlaceholder: "Please enter verification code",
        identity: "Identity",
        student: "Student",
        teacher: "Teacher",
        parent: "Parent",
        registerButton: "Register",
        registeringButton: "Registering...",
        hasAccount: "Already have an account?",
        loginNow: "Login now",
        passwordStrength: "Password Strength",
        weak: "Weak",
        medium: "Medium",
        strong: "Strong",
        passwordRequirements: {
          length: "8-16 characters",
          uppercase: "Contains uppercase letter",
          lowercase: "Contains lowercase letter",
          number: "Contains number",
          symbol: "Contains special character",
          noSpace: "No spaces",
          noRepeat: "No consecutive repeated characters",
          noConsecutive: "No consecutive character sequences",
          noUsername: "Does not contain username"
        }
      },
      
      home: {
        welcome: "Welcome to",
        brandName: "ZhiHuiShi",
        mainTitle: "Welcome to ZhiHuiShi Education",
        mainSubtitle: "Providing quality educational resources for children's future",
        banners: {
          promotion1: "20th Anniversary Season - Up to 600 yuan off for returning students",
          promotion2: "New student exclusive offer - 300 yuan off your first purchase",
          promotion3: "Winter course enrollment - Early bird discount available"
        },
        // Navigation menu
        navigation: {
          home: "Home",
          learningMachine: "Learning Machine", 
          onlineSchool: "ZhiHuiShi Online School",
          premiumCourses: "Premium Quality Courses",
          smartBooks: "Smart Books",
          aiModel: "Jiuzhang AI Model",
          ourStory: "Our Story",
          allMenu: "All"
        },
        // Drawer menu
        drawer: {
          title: "ZhiHuiShi",
          selectCourse: "Select Course",
          learningClub: "Learning Club", 
          schedule: "Schedule",
          mobileApp: "ZhiHuiShi Mobile App",
          smartBooks: "Smart Books",
          premiumSelection: "Premium Course Selection",
          premiumLecture: "Premium Lectures",
          shanghaiClass: "Shanghai ZhiHui Classroom",
          aboutUs: "About ZhiHuiShi",
          helpCenter: "Help Center",
          logout: "Logout"
        },
        // Product information
        products: {
          title: "Featured Products",
          viewAll: "View All",
          addToCart: "Add to Cart",
          buyNow: "Buy Now",
          mobi: "Mobi Math",
          secret: "XES Secret",
          machine: "Mobi Learning Machine",
          basic: "XES Basics",
          training: "In-class Training",
          descriptions: {
            mobi: "Best-selling thinking enlightenment books with over 4 million copies sold",
            secret: "Thinking cultivation and foundation consolidation",
            machine: "New enlightenment method, all-in-one solution",
            basic: "Extension and stage review",
            training: "Thinking cultivation and foundation consolidation"
          }
        },
        // Course related
        courses: {
          title: "Premium Courses",
          premium: "Premium Courses",
          premiumSelection: "Premium Course Selection",
          free: "Free Courses",
          popular: "Popular",
          latest: "Latest",
          viewAll: "View All",
          enrollNow: "Enroll Now",
          tags: {
            hot: "Hot Sale",
            new: "New Course", 
            discount: "Limited Time Offer"
          },
          items: {
            mathThinking: "Elementary Math Thinking Training",
            englishStart: "English Enlightenment Premium Course",
            programmingThinking: "Programming Thinking Enlightenment"
          },
          descriptions: {
            mathThinking: "Develop logical thinking and improve math skills",
            englishStart: "Fun English learning, building language foundation", 
            programmingThinking: "Develop computational thinking, master future skills"
          }
        },
        // Bottom tab bar
        tabBar: {
          home: "Home",
          courses: "Courses", 
          books: "Books",
          chat: "Chat",
          profile: "Profile"
        },
        footer: {
          about: "About Us",
          contact: "Contact Us",
          help: "Help Center",
          terms: "Terms of Service",
          privacy: "Privacy Policy"
        }
      },
      
      admin: {
        title: "Admin Panel",
        welcome: "Welcome to Management Center",
        menu: {
          dashboard: "Dashboard",
          userManagement: "User Management",
          students: "Student Management",
          teachers: "Teacher Management",
          courseManagement: "Course Management",
          orderManagement: "Order Management",
          orders: "Orders",
          refunds: "Refunds",
          contentManagement: "Content Management",
          banners: "Banner Management",
          articles: "Article Management",
          promotionManagement: "Promotion Management",
          flashSales: "Flash Sales",
          coupons: "Coupon Management",
          systemSettings: "System Settings"
        },
        content: {
          refunds: "Refund management content",
          banners: "Banner management content",
          articles: "Article management content",
          flashSales: "Flash sale management content",
          coupons: "Coupon management content",
          systemSettings: "System settings content"
        },
        breadcrumb: {
          home: "Home",
          userManagement: "User Management",
          students: "Students",
          teachers: "Teachers",
          courseManagement: "Course Management",
          orderManagement: "Order Management",
          orders: "Orders",
          refunds: "Refunds",
          contentManagement: "Content Management",
          banners: "Banners",
          articles: "Articles",
          promotionManagement: "Promotion Management",
          flashSales: "Flash Sales",
          coupons: "Coupons",
          systemSettings: "System Settings"
        },
        actions: {
          add: "Add",
          edit: "Edit",
          delete: "Delete",
          view: "View",
          export: "Export",
          import: "Import",
          refresh: "Refresh",
          search: "Search",
          filter: "Filter",
          reset: "Reset"
        },
        table: {
          noData: "No data available",
          total: "Total {count} items",
          pageSize: "Items per page",
          items: "items"
        }
      },
      
      course: {
        title: "Course Center",
        categories: "Categories",
        allCourses: "All Courses",
        myLearning: "My Learning",
        completed: "Completed",
        inProgress: "In Progress",
        notStarted: "Not Started",
        duration: "Duration",
        difficulty: "Difficulty",
        beginner: "Beginner",
        intermediate: "Intermediate",
        advanced: "Advanced",
        instructor: "Instructor",
        students: "Students",
        rating: "Rating",
        price: "Price",
        free: "Free",
        enroll: "Enroll Now",
        preview: "Preview",
        details: "Course Details",
        reviews: "Reviews",
        curriculum: "Curriculum"
      },
      
      live: {
        title: "Live Center",
        liveNow: "Live Now",
        upcoming: "Upcoming",
        replay: "Replay",
        joinLive: "Join Live",
        startLive: "Start Live",
        endLive: "End Live",
        viewers: "Viewers",
        likes: "Likes",
        comments: "Comments",
        share: "Share",
        fullscreen: "Fullscreen",
        settings: "Settings",
        quality: "Quality",
        volume: "Volume"
      },
      
      ai: {
        title: "AI Assistant",
        placeholder: "Please enter your question...",
        send: "Send",
        thinking: "Thinking...",
        newChat: "New Chat",
        history: "History",
        clear: "Clear Chat",
        export: "Export Chat",
        suggestions: "Suggested Questions",
        interrupted: "AI response interrupted"
      },
      
      security: {
        title: "Security Verification",
        back: "Back",
        riskUser: "Risk User Account",
        abnormalLogin: "Abnormal Login Detection",
        selectMethod: "Select verification method:",
        enterPassword: "Please enter current account password",
        enterCode: "Please enter verification code",
        sending: "Sending...",
        sendCode: "Send Code",
        verifying: "Verifying...",
        verify: "Verify",
        cancel: "Cancel",
        enterVerification: "Please enter verification information",
        verificationFailed: "Verification failed, please try again later"
      },
      
      language: {
        select: "Select Language",
        chinese: "中文",
        english: "English",
        japanese: "日本語",
        korean: "한국어"
      },
      
      common: {
        loading: "Loading...",
        success: "Login successful",
        failed: "Login failed",
        confirm: "Confirm",
        cancel: "Cancel",
        save: "Save",
        edit: "Edit",
        delete: "Delete",
        search: "Search",
        reset: "Reset",
        rememberMe: "Remember me",
        submit: "Submit",
        close: "Close",
        back: "Back",
        next: "Next",
        previous: "Previous",
        finish: "Finish",
        retry: "Retry",
        refresh: "Refresh",
        copy: "Copy",
        download: "Download",
        upload: "Upload",
        preview: "Preview",
        print: "Print",
        settings: "Settings",
        help: "Help",
        about: "About",
        version: "Version",
        update: "Update",
        new: "New",
        open: "Open",
        selectAll: "Select All",
        clear: "Clear",
        expand: "Expand",
        collapse: "Collapse",
        more: "More",
        less: "Less"
      }
    }
  },
  ja: {
    translation: {
      navigation: {
        home: "ホーム",
        courses: "コース",
        about: "私たちについて",
        contact: "お問い合わせ",
        profile: "プロフィール",
        logout: "ログアウト",
        dashboard: "ダッシュボード",
        management: "管理"
      },
      
      login: {
        title: "ユーザーログイン/登録",
        close: "閉じる",
        passwordLogin: "パスワードログイン",
        codeLogin: "認証コードログイン",
        phoneEmailPlaceholder: "電話番号/メール/ユーザー名を入力してください",
        phonePlaceholder: "電話番号を入力してください",
        passwordPlaceholder: "パスワードを入力してください",
        codePlaceholder: "認証コードを入力してください",
        loginButton: "ログイン",
        loginButtonLoading: "ログイン中...",
        forgotPassword: "パスワードを忘れましたか？",
        register: "今すぐ登録",
        getCode: "コードを取得",
        getCodeRetry: "秒後に再送信",
        thirdPartyLogin: "その他のログイン方法：",
        wechatLogin: "WeChatログイン",
        qqLogin: "QQログイン",
        agreement: "ログインすることで利用規約に同意したことになります",
        serviceTerms: "利用規約とプライバシーポリシー",
        errors: {
          fillRequired: "電話番号/メールとパスワードを入力してください",
          fillPhoneCode: "電話番号と認証コードを入力してください",
          invalidPhone: "有効な電話番号を入力してください",
          invalidEmail: "有効なメールアドレスを入力してください",
          enterPhoneOrEmail: "まず電話番号またはメールアドレスを入力してください",
          enterValidPhoneOrEmail: "有効な電話番号またはメールアドレスを入力してください",
          sendCodeFailed: "認証コードの送信に失敗しました。後でもう一度お試しください",
          wrongCredentials: "ユーザー名またはパスワードが間違っています",
          networkError: "サーバーに接続できません。ネットワークを確認してください",
          serverError: "サーバーエラー"
        }
      },
      
      register: {
        title: "ユーザー登録",
        phoneRegister: "電話番号登録",
        emailRegister: "メール登録",
        usernamePlaceholder: "ユーザー名を入力してください",
        phonePlaceholder: "電話番号を入力してください",
        emailPlaceholder: "メールアドレスを入力してください",
        passwordPlaceholder: "パスワードを入力してください",
        confirmPasswordPlaceholder: "パスワードを確認してください",
        codePlaceholder: "認証コードを入力してください",
        identity: "身分",
        student: "学生",
        teacher: "教師",
        parent: "保護者",
        registerButton: "登録",
        registeringButton: "登録中...",
        hasAccount: "アカウントをお持ちですか？",
        loginNow: "今すぐログイン",
        passwordStrength: "パスワード強度",
        weak: "弱い",
        medium: "普通",
        strong: "強い",
        passwordRequirements: {
          length: "8-16文字",
          uppercase: "大文字を含む",
          lowercase: "小文字を含む",
          number: "数字を含む",
          symbol: "特殊文字を含む",
          noSpace: "スペースなし",
          noRepeat: "連続する重複文字なし",
          noConsecutive: "連続する文字列なし",
          noUsername: "ユーザー名を含まない"
        }
      },
      
      home: {
        welcome: "ようこそ",
        brandName: "智絵師",
        mainTitle: "智絵師教育へようこそ",
        mainSubtitle: "子どもたちの未来のために質の高い教育リソースを提供",
        banners: {
          promotion1: "20周年感謝祭 既存学習者は学習機を最大600元割引",
          promotion2: "新規学習者限定 初回購入で学習機300元割引",
          promotion3: "冬期講座申込受付中 早期割引実施中"
        },
        // ナビゲーションメニュー
        navigation: {
          home: "ホーム",
          learningMachine: "学習機", 
          onlineSchool: "智絵師オンラインスクール",
          premiumCourses: "優良素養コース",
          smartBooks: "スマートブック",
          aiModel: "九章AIモデル",
          ourStory: "私たちの物語",
          allMenu: "すべて"
        },
        // ドロワーメニュー
        drawer: {
          title: "智絵師",
          selectCourse: "コース選択",
          learningClub: "学習クラブ", 
          schedule: "時間割",
          mobileApp: "智絵師モバイルアプリ",
          smartBooks: "スマートブック",
          premiumSelection: "プレミアムコース選抜",
          premiumLecture: "プレミアム講座",
          shanghaiClass: "上海智絵教室",
          aboutUs: "智絵師について",
          helpCenter: "ヘルプセンター",
          logout: "ログアウト"
        },
        // 商品情報
        products: {
          title: "厳選商品",
          viewAll: "すべて見る",
          addToCart: "カートに追加",
          buyNow: "今すぐ購入",
          mobi: "モビ数学",
          secret: "学而思秘籍",
          machine: "モビ学習機",
          basic: "学而思基本功",
          training: "授業内トレーニング",
          descriptions: {
            mobi: "400万部突破の思考啓発人気図書",
            secret: "思考力育成・基礎固め",
            machine: "新しい啓発方式、一台で完結",
            basic: "拡張・段階復習",
            training: "思考力育成・基礎固め"
          }
        },
        // コース関連
        courses: {
          title: "プレミアムコース",
          premium: "プレミアムコース",
          premiumSelection: "プレミアムコース選抜",
          free: "無料コース",
          popular: "人気",
          latest: "最新",
          viewAll: "すべて見る",
          enrollNow: "今すぐ申込",
          tags: {
            hot: "人気",
            new: "新コース", 
            discount: "期間限定特価"
          },
          items: {
            mathThinking: "小学算数思考力訓練",
            englishStart: "英語啓発プレミアムコース",
            programmingThinking: "プログラミング思考啓発"
          },
          descriptions: {
            mathThinking: "論理的思考を育て、数学力を向上",
            englishStart: "楽しい英語学習で言語基礎を築く", 
            programmingThinking: "計算思考を育て、未来のスキルを習得"
          }
        },
        // 底部タブバー
        tabBar: {
          home: "ホーム",
          courses: "コース", 
          books: "図書",
          chat: "チャット",
          profile: "マイページ"
        },
        footer: {
          about: "私たちについて",
          contact: "お問い合わせ",
          help: "ヘルプセンター",
          terms: "利用規約",
          privacy: "プライバシーポリシー"
        }
      },
      
      admin: {
        title: "管理パネル",
        welcome: "管理センターへようこそ",
        menu: {
          dashboard: "ダッシュボード",
          userManagement: "ユーザー管理",
          students: "学生管理",
          teachers: "教師管理",
          courseManagement: "コース管理",
          orderManagement: "注文管理",
          orders: "注文",
          refunds: "返金",
          contentManagement: "コンテンツ管理",
          banners: "バナー管理",
          articles: "記事管理",
          promotionManagement: "プロモーション管理",
          flashSales: "フラッシュセール",
          coupons: "クーポン管理",
          systemSettings: "システム設定"
        },
        breadcrumb: {
          home: "ホーム",
          userManagement: "ユーザー管理",
          students: "学生",
          teachers: "教師",
          courseManagement: "コース管理",
          orderManagement: "注文管理",
          orders: "注文",
          refunds: "返金",
          contentManagement: "コンテンツ管理",
          banners: "バナー",
          articles: "記事",
          promotionManagement: "プロモーション管理",
          flashSales: "フラッシュセール",
          coupons: "クーポン",
          systemSettings: "システム設定"
        },
        actions: {
          add: "追加",
          edit: "編集",
          delete: "削除",
          view: "表示",
          export: "エクスポート",
          import: "インポート",
          refresh: "更新",
          search: "検索",
          filter: "フィルター",
          reset: "リセット"
        },
        table: {
          noData: "データがありません",
          total: "合計 {count} 件",
          pageSize: "ページあたり",
          items: "件"
        }
      },
      
      course: {
        title: "コースセンター",
        categories: "カテゴリ",
        allCourses: "すべてのコース",
        myLearning: "マイ学習",
        completed: "完了",
        inProgress: "学習中",
        notStarted: "未開始",
        duration: "期間",
        difficulty: "難易度",
        beginner: "初級",
        intermediate: "中級",
        advanced: "上級",
        instructor: "講師",
        students: "学生数",
        rating: "評価",
        price: "価格",
        free: "無料",
        enroll: "今すぐ登録",
        preview: "プレビュー",
        details: "コース詳細",
        reviews: "レビュー",
        curriculum: "カリキュラム"
      },
      
      live: {
        title: "ライブセンター",
        liveNow: "ライブ中",
        upcoming: "近日開催",
        replay: "再生",
        joinLive: "ライブに参加",
        startLive: "ライブ開始",
        endLive: "ライブ終了",
        viewers: "視聴者数",
        likes: "いいね数",
        comments: "コメント",
        share: "共有",
        fullscreen: "フルスクリーン",
        settings: "設定",
        quality: "画質",
        volume: "音量"
      },
      
      ai: {
        title: "AIアシスタント",
        placeholder: "質問を入力してください...",
        send: "送信",
        thinking: "考え中...",
        newChat: "新しいチャット",
        history: "履歴",
        clear: "チャットをクリア",
        export: "チャットをエクスポート",
        suggestions: "提案された質問"
      },
      
      security: {
        title: "セキュリティ認証",
        back: "戻る",
        riskUser: "リスクユーザーアカウント",
        abnormalLogin: "異常ログイン検出",
        selectMethod: "認証方法を選択：",
        enterPassword: "現在のアカウントパスワードを入力してください",
        enterCode: "認証コードを入力してください",
        sending: "送信中...",
        sendCode: "コードを送信",
        verifying: "認証中...",
        verify: "認証",
        cancel: "キャンセル",
        enterVerification: "認証情報を入力してください",
        verificationFailed: "認証に失敗しました。後でもう一度お試しください"
      },
      
      language: {
        select: "言語を選択",
        chinese: "中文",
        english: "English",
        japanese: "日本語",
        korean: "한국어"
      },
      
      common: {
        loading: "読み込み中...",
        success: "ログイン成功",
        failed: "ログイン失敗",
        confirm: "確認",
        cancel: "キャンセル",
        save: "保存",
        edit: "編集",
        delete: "削除",
        search: "検索",
        reset: "リセット",
        rememberMe: "ログイン状態を保持",
        submit: "送信",
        close: "閉じる",
        back: "戻る",
        next: "次へ",
        previous: "前へ",
        finish: "完了",
        retry: "再試行",
        refresh: "更新",
        copy: "コピー",
        download: "ダウンロード",
        upload: "アップロード",
        preview: "プレビュー",
        print: "印刷",
        settings: "設定",
        help: "ヘルプ",
        about: "について",
        version: "バージョン",
        update: "更新",
        new: "新規",
        open: "開く",
        selectAll: "すべて選択",
        clear: "クリア",
        expand: "展開",
        collapse: "折りたたみ",
        more: "もっと",
        less: "少なく"
      }
    }
  },
  ko: {
    translation: {
      navigation: {
        home: "홈",
        courses: "코스",
        about: "회사 소개",
        contact: "연락처",
        profile: "프로필",
        logout: "로그아웃",
        dashboard: "대시보드",
        management: "관리"
      },
      
      login: {
        title: "사용자 로그인/등록",
        close: "닫기",
        passwordLogin: "비밀번호 로그인",
        codeLogin: "인증번호 로그인",
        phoneEmailPlaceholder: "휴대폰/이메일/사용자명을 입력하세요",
        phonePlaceholder: "휴대폰 번호를 입력하세요",
        passwordPlaceholder: "비밀번호를 입력하세요",
        codePlaceholder: "인증번호를 입력하세요",
        loginButton: "로그인",
        loginButtonLoading: "로그인 중...",
        forgotPassword: "비밀번호를 잊으셨나요?",
        register: "지금 가입",
        getCode: "인증번호 받기",
        getCodeRetry: "초 후 재전송",
        thirdPartyLogin: "다른 로그인 방법:",
        wechatLogin: "위챗 로그인",
        qqLogin: "QQ 로그인",
        agreement: "로그인하면 서비스 약관에 동의한 것으로 간주됩니다",
        serviceTerms: "서비스 약관 및 개인정보 보호정책",
        errors: {
          fillRequired: "휴대폰/이메일과 비밀번호를 입력하세요",
          fillPhoneCode: "휴대폰 번호와 인증번호를 입력하세요",
          invalidPhone: "유효한 휴대폰 번호를 입력하세요",
          invalidEmail: "유효한 이메일을 입력하세요",
          enterPhoneOrEmail: "먼저 휴대폰 번호 또는 이메일을 입력하세요",
          enterValidPhoneOrEmail: "유효한 휴대폰 번호 또는 이메일을 입력하세요",
          sendCodeFailed: "인증번호 전송 실패, 나중에 다시 시도하세요",
          wrongCredentials: "사용자명 또는 비밀번호가 틀렸습니다",
          networkError: "서버에 연결할 수 없습니다. 네트워크를 확인하세요",
          serverError: "서버 오류"
        }
      },
      
      register: {
        title: "사용자 등록",
        phoneRegister: "휴대폰 등록",
        emailRegister: "이메일 등록",
        usernamePlaceholder: "사용자명을 입력하세요",
        phonePlaceholder: "휴대폰 번호를 입력하세요",
        emailPlaceholder: "이메일 주소를 입력하세요",
        passwordPlaceholder: "비밀번호를 입력하세요",
        confirmPasswordPlaceholder: "비밀번호를 확인하세요",
        codePlaceholder: "인증번호를 입력하세요",
        identity: "신분",
        student: "학생",
        teacher: "교사",
        parent: "학부모",
        registerButton: "등록",
        registeringButton: "등록 중...",
        hasAccount: "계정이 있으신가요?",
        loginNow: "지금 로그인",
        passwordStrength: "비밀번호 강도",
        weak: "약함",
        medium: "보통",
        strong: "강함",
        passwordRequirements: {
          length: "8-16자",
          uppercase: "대문자 포함",
          lowercase: "소문자 포함",
          number: "숫자 포함",
          symbol: "특수문자 포함",
          noSpace: "공백 없음",
          noRepeat: "연속 중복 문자 없음",
          noConsecutive: "연속 문자 시퀀스 없음",
          noUsername: "사용자명 포함하지 않음"
        }
      },
      
      home: {
        welcome: "환영합니다",
        brandName: "지혜사",
        mainTitle: "지혜사 교육에 오신 것을 환영합니다",
        mainSubtitle: "아이들의 미래를 위한 양질의 교육 자원 제공",
        banners: {
          promotion1: "20주년 감사 시즌 기존 학습자 학습기 최대 600원 할인",
          promotion2: "신규 학습자 전용 할인 첫 구매 시 학습기 300원 할인",
          promotion3: "겨울 코스 신청 접수 중 조기 할인 실시 중"
        },
        // 내비게이션 메뉴
        navigation: {
          home: "홈",
          learningMachine: "학습기", 
          onlineSchool: "지혜사 온라인 스쿨",
          premiumCourses: "프리미엄 소양 코스",
          smartBooks: "스마트 북",
          aiModel: "구장 AI 모델",
          ourStory: "우리의 이야기",
          allMenu: "전체"
        },
        // 드로어 메뉴
        drawer: {
          title: "지혜사",
          selectCourse: "코스 선택",
          learningClub: "학습 클럽", 
          schedule: "시간표",
          mobileApp: "지혜사 모바일 앱",
          smartBooks: "스마트 북",
          premiumSelection: "프리미엄 코스 선별",
          premiumLecture: "프리미엄 강의",
          shanghaiClass: "상하이 지혜 교실",
          aboutUs: "지혜사 소개",
          helpCenter: "도움말 센터",
          logout: "로그아웃"
        },
        // 상품 정보
        products: {
          title: "엄선 상품",
          viewAll: "모두 보기",
          addToCart: "장바구니에 추가",
          buyNow: "지금 구매",
          mobi: "모비 수학",
          secret: "학이사 비급",
          machine: "모비 학습기",
          basic: "학이사 기본공",
          training: "수업 내 훈련",
          descriptions: {
            mobi: "400만 부 돌파 사고 계발 인기 도서",
            secret: "사고력 배양, 기초 다지기",
            machine: "새로운 계발 방식, 한 대로 완성",
            basic: "확장 연장, 단계 복습",
            training: "사고력 배양, 기초 다지기"
          }
        },
        // 코스 관련
        courses: {
          title: "프리미엄 코스",
          premium: "프리미엄 코스",
          premiumSelection: "프리미엄 코스 선별",
          free: "무료 코스",
          popular: "인기",
          latest: "최신",
          viewAll: "모두 보기",
          enrollNow: "지금 신청",
          tags: {
            hot: "인기",
            new: "신규 코스", 
            discount: "한정 특가"
          },
          items: {
            mathThinking: "초등 수학 사고력 훈련",
            englishStart: "영어 계발 프리미엄 코스",
            programmingThinking: "프로그래밍 사고 계발"
          },
          descriptions: {
            mathThinking: "논리적 사고를 기르고 수학 능력 향상",
            englishStart: "재미있는 영어 학습으로 언어 기초 다지기", 
            programmingThinking: "계산 사고를 기르고 미래 기술 습득"
          }
        },
        // 하단 탭바
        tabBar: {
          home: "홈",
          courses: "코스", 
          books: "도서",
          chat: "채팅",
          profile: "마이페이지"
        },
        footer: {
          about: "회사 소개",
          contact: "연락처",
          help: "도움말 센터",
          terms: "서비스 약관",
          privacy: "개인정보 보호정책"
        }
      },
      
      admin: {
        title: "관리 패널",
        welcome: "관리 센터에 오신 것을 환영합니다",
        menu: {
          dashboard: "대시보드",
          userManagement: "사용자 관리",
          students: "학생 관리",
          teachers: "교사 관리",
          courseManagement: "코스 관리",
          orderManagement: "주문 관리",
          orders: "주문",
          refunds: "환불",
          contentManagement: "콘텐츠 관리",
          banners: "배너 관리",
          articles: "기사 관리",
          promotionManagement: "프로모션 관리",
          flashSales: "플래시 세일",
          coupons: "쿠폰 관리",
          systemSettings: "시스템 설정"
        },
        breadcrumb: {
          home: "홈",
          userManagement: "사용자 관리",
          students: "학생",
          teachers: "교사",
          courseManagement: "코스 관리",
          orderManagement: "주문 관리",
          orders: "주문",
          refunds: "환불",
          contentManagement: "콘텐츠 관리",
          banners: "배너",
          articles: "기사",
          promotionManagement: "프로모션 관리",
          flashSales: "플래시 세일",
          coupons: "쿠폰",
          systemSettings: "시스템 설정"
        },
        actions: {
          add: "추가",
          edit: "편집",
          delete: "삭제",
          view: "보기",
          export: "내보내기",
          import: "가져오기",
          refresh: "새로고침",
          search: "검색",
          filter: "필터",
          reset: "초기화"
        },
        table: {
          noData: "데이터가 없습니다",
          total: "총 {count}개",
          pageSize: "페이지당",
          items: "개"
        }
      },
      
      course: {
        title: "코스 센터",
        categories: "카테고리",
        allCourses: "모든 코스",
        myLearning: "내 학습",
        completed: "완료",
        inProgress: "학습 중",
        notStarted: "시작 안함",
        duration: "기간",
        difficulty: "난이도",
        beginner: "초급",
        intermediate: "중급",
        advanced: "고급",
        instructor: "강사",
        students: "학생 수",
        rating: "평점",
        price: "가격",
        free: "무료",
        enroll: "지금 등록",
        preview: "미리보기",
        details: "코스 상세",
        reviews: "리뷰",
        curriculum: "커리큘럼"
      },
      
      live: {
        title: "라이브 센터",
        liveNow: "라이브 중",
        upcoming: "곧 시작",
        replay: "재생",
        joinLive: "라이브 참여",
        startLive: "라이브 시작",
        endLive: "라이브 종료",
        viewers: "시청자 수",
        likes: "좋아요 수",
        comments: "댓글",
        share: "공유",
        fullscreen: "전체화면",
        settings: "설정",
        quality: "화질",
        volume: "볼륨"
      },
      
      ai: {
        title: "AI 어시스턴트",
        placeholder: "질문을 입력하세요...",
        send: "보내기",
        thinking: "생각 중...",
        newChat: "새 채팅",
        history: "기록",
        clear: "채팅을 지우기",
        export: "채팅을 내보내기",
        suggestions: "제안된 질문"
      },
      
      security: {
        title: "보안 인증",
        back: "돌아가기",
        riskUser: "위험 사용자 계정",
        abnormalLogin: "비정상 로그인 감지",
        selectMethod: "인증 방법 선택:",
        enterPassword: "현재 계정 비밀번호를 입력하세요",
        enterCode: "인증번호를 입력하세요",
        sending: "전송 중...",
        sendCode: "인증번호 전송",
        verifying: "인증 중...",
        verify: "인증",
        cancel: "취소",
        enterVerification: "인증 정보를 입력하세요",
        verificationFailed: "인증 실패, 나중에 다시 시도하세요"
      },
      
      language: {
        select: "언어 선택",
        chinese: "中文",
        english: "English",
        japanese: "日本語",
        korean: "한국어"
      },
      
      common: {
        loading: "로딩 중...",
        success: "로그인 성공",
        failed: "로그인 실패",
        confirm: "확인",
        cancel: "취소",
        save: "저장",
        edit: "편집",
        delete: "삭제",
        search: "검색",
        reset: "초기화",
        rememberMe: "로그인 상태 유지",
        submit: "제출",
        close: "닫기",
        back: "뒤로",
        next: "다음",
        previous: "이전",
        finish: "완료",
        retry: "다시 시도",
        refresh: "새로고침",
        copy: "복사",
        download: "다운로드",
        upload: "업로드",
        preview: "미리보기",
        print: "인쇄",
        settings: "설정",
        help: "도움말",
        about: "정보",
        version: "버전",
        update: "업데이트",
        new: "새로 만들기",
        open: "열기",
        selectAll: "모두 선택",
        clear: "지우기",
        expand: "펼치기",
        collapse: "접기",
        more: "더 보기",
        less: "간략히"
      }
    }
  }
};

i18n
  .use(initReactI18next)
  .init({
    resources,
    lng: localStorage.getItem('language') || 'zh', // 默认语言为中文
    fallbackLng: 'zh',
    
    interpolation: {
      escapeValue: false
    },
    
    // 其他配置
    debug: false,
    
    // 缓存配置
    saveMissing: true,
    saveMissingTo: 'current'
  });

export default i18n; 